//
//  MainDiscernVC.m
//  ZITHER
//
//  Created by weixin on 2018/11/27.
//  Copyright © 2018 weixn. All rights reserved.
//

#import "MainDiscernVC.h"
#import "MainDiscernTbv.h"
#import "MainDiscernSelectWatchVC.h"

@interface MainDiscernVC ()

@property (nonatomic,strong)MainDiscernTbv * tbv;

@property (nonatomic,strong)BaseBtn * btn;

@end

@implementation MainDiscernVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setNav];
    [self setUI];
}

-(void)setNav{
    [self.baseNavigationView setHiddenNav:NO VC:self];
    [self.baseNavigationView NavigationBarStyle:1];
    self.baseNavigationView.navViewStyle.title.text = @"拍照";
//    self.baseNavigationView.navViewStyle.leftBtn.hidden = YES;
    self.baseNavigationView.leftButton1.hidden = YES;
    
}

-(void)setUI{
    
    [self.view addSubview:self.tbv];
    
    [self.view addSubview:self.btn];
    
    [self.tbv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(NaviHeight);
        make.left.right.equalTo(self.view).offset(0);
        make.height.mas_equalTo(kScreenH-NaviHeight);
    }];
    
    [self.btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view.mas_bottom).offset(-kBottomSafeHeight-20);
        make.left.equalTo(self.view).offset(15);
        make.right.equalTo(self.view).offset(-15);
        make.height.mas_equalTo(45);
    }];
}

- (MainDiscernTbv *)tbv{
    if (!_tbv) {
        _tbv = [[MainDiscernTbv alloc]initializeFrame:CGRectMake(0, 0, 1, 1) isMj:0 isEstimatedRowHeight:YES addRegisterNib:@[@"MainDiscernTbvShootCell",@"MainDiscernTbvCellPic"]];
    }
    return _tbv;
}


-(BaseBtn *)btn{
    if (!_btn) {
        _btn = [[BaseBtn alloc]initializeFrame:CGRectMake(0, 0, 1, 1) NormalText:@"下一步" NormalTextColor:baseColorTheme SeleText:@"" SeleTextColor:baseColorTheme  font:15 isBold:NO];
        [_btn setCornerRadiusWithRadius:4 isMasks:YES];
        [_btn setBorderWithColor:baseColorTheme width:1];
        /** 按钮点击案例 */
        @weakify(self);
        [[_btn rac_signalForControlEvents:(UIControlEventTouchUpInside)] subscribeNext:^(__kindof UIControl * _Nullable x) {
            @strongify(self);
            if (self.tbv.id.length>0) {
               
                MainDiscernSelectWatchVC *vc = [[MainDiscernSelectWatchVC alloc]init];
                vc.videoID = self.tbv.videoID;
                vc.id = self.tbv.id;
                [self.navigationController pushViewController:vc animated:YES];
            }else{
                [Tools showTips:@"请拍摄视频"];
            }
          
        }];
    }
    return _btn;
}

-(void)next{
    

}

@end
